<div class="content">
	<div class="lookup">
		<form action="" method="post">
			<label>Chọn ngày</label>
			<div class="box-select">
				<select name="day" class="date">
					<option>Ngày</option>
					<?php for($d=1; $d<=31; $d++):?>
					<option <?php echo(isset($input_form['day']) && $input_form['day'] == $d ? 'selected="selected"' : '');?> value="<?php echo $d;?>"><?php echo $d;?></option>
					<?php endfor;?>
				</select>
				<select name="month" class="month">
					<option>Tháng</option>
					<?php for($m=1; $m <= 12; $m++):?>
					<option <?php echo(isset($input_form['month']) && $input_form['month'] == $m ? 'selected="selected"' : '');?> value="<?php echo $m;?>"><?php echo $m;?></option>
					<?php endfor;?>
				</select>
				<select name="year" class="year">
					<option>Năm</option>
					<?php $cur_y = date('Y');?>
					<?php for($y = ($cur_y - 5); $y <= $cur_y; $y++):?>
					<option <?php echo(isset($input_form['year']) && $input_form['year'] == $y ? 'selected="selected"' : '');?> value="<?php echo $y;?>"><?php echo $y;?></option>
					<?php endfor;?>
				</select>
			</div>
			<button type="submit" class="box-css3"><span>Xem</span></button>
		</form>
	</div>	
	
	<div class="detail-top">
	<?php if(isset($data) && $data):?>
	<?php foreach($data as $result):?>
		<h2>Kết quả xổ số:&nbsp;<?php echo $result->city_name;?></h2>
		<table class="tbl-list">
			<tr>
				<th class="first">ĐB:</th>
				<th class="last"><?php echo $result->a0;?></th>
			</tr>
			<tr>
				<td>G1:</td>
				<td><?php echo $result->a1;?></td>
			</tr>
			<tr>
				<td>G2:</td>
				<td><?php echo show_prize($result->a2);?></td>
			</tr>
			<tr>
				<td>G3:</td>
				<td>
					<?php echo show_prize($result->a3);?>
				</td>
			</tr>
			<tr>
				<td>G4:</td>
				<td>
					<?php echo show_prize($result->a4);?>
				</td>
			</tr>
			<tr>
				<td>G5:</td>
				<td>
					<?php echo show_prize($result->a5);?>
				</td>
			</tr>
			<tr>
				<td>G6:</td>
				<td>
					<?php echo show_prize($result->a6);?>
				</td>
			</tr>
			<tr>
				<td>G7:</td>
				<td>
					<?php echo show_prize($result->a7);?>
				</td>
			</tr>
			<?php if($result->a8 != ''):?>
			<tr>
				<td>G8:</td>
				<td>
					<?php echo show_prize($result->a8);?>
				</td>
			</tr>
			<?php endif;?>
		</table>
		<table class="tbl-list">
			<tr>
				<th class="first">Đầu</th>
				<th class="last">Đuôi</th>
			</tr>
			<?php 
			$extension = json_decode($result->extension);
			?>
			<?php foreach($extension as $k => $v):?>
			<tr>
				<td><?php echo $k;?></td>
				<td><?php echo show_extension($v);?></td>
			</tr>
			<?php endforeach;?>
		</table>
	<?php endforeach;?>
	<?php else:?>
		<?php if($_SERVER['REQUEST_METHOD'] == 'POST'):?>
		<h2>Không tìm thấy kết quả!</h2>
		<?php endif;?>
	<?php endif;?>
	</div>
	
	<div class="bot-mobile clearfix">
		<div class="share">Chia sẻ lên</div>
		<?php $this->load->view('client/layout/shared');?>
	</div>
</div>